/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package negocio;

import java.io.Serializable;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author eriksigcha
 */
@Entity
@Table(name = "valor")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Valor.findAll", query = "SELECT v FROM Valor v"),
    @NamedQuery(name = "Valor.findByIdvalor", query = "SELECT v FROM Valor v WHERE v.idvalor = :idvalor"),
    @NamedQuery(name = "Valor.findByValor", query = "SELECT v FROM Valor v WHERE v.valor = :valor"),
    @NamedQuery(name = "Valor.findByFecha", query = "SELECT v FROM Valor v WHERE v.fecha = :fecha")})
public class Valor implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "idvalor")
    private Integer idvalor;
    // @Max(value=?)  @Min(value=?)//if you know range of your decimal fields consider using these annotations to enforce field validation
    @Column(name = "valor")
    private Float valor;
    @Column(name = "fecha")
    @Temporal(TemporalType.DATE)
    private Date fecha;
    @JoinColumn(name = "indicador_idindicador", referencedColumnName = "idindicador")
    @ManyToOne(optional = false)
    private Indicador indicadorIdindicador;

    public Valor() {
    }

    public Valor(Integer idvalor) {
        this.idvalor = idvalor;
    }

    public Integer getIdvalor() {
        return idvalor;
    }

    public void setIdvalor(Integer idvalor) {
        this.idvalor = idvalor;
    }

    public Float getValor() {
        return valor;
    }

    public void setValor(Float valor) {
        this.valor = valor;
    }

    public Date getFecha() {
        return fecha;
    }

    public void setFecha(Date fecha) {
        this.fecha = fecha;
    }

    public Indicador getIndicadorIdindicador() {
        return indicadorIdindicador;
    }

    public void setIndicadorIdindicador(Indicador indicadorIdindicador) {
        this.indicadorIdindicador = indicadorIdindicador;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idvalor != null ? idvalor.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Valor)) {
            return false;
        }
        Valor other = (Valor) object;
        if ((this.idvalor == null && other.idvalor != null) || (this.idvalor != null && !this.idvalor.equals(other.idvalor))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "negocio.Valor[ idvalor=" + idvalor + " ]";
    }
    
}
